﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Collections.Generic;

public partial class ResumeSearchResult : System.Web.UI.Page
{
    string industryset = "";
    string redirectlink = "";
    string minexp = "", maxexp = "", maxex = "", minex = "";
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (Request.QueryString["mode"] != null && Request.QueryString["industryset"] != null)
            {
                if (clsEncryptionDecryption.DecryptQueryString(Convert.ToString(Request.QueryString["mode"])) == "ByIndustry")
                {
                    industryset = clsEncryptionDecryption.DecryptQueryString(Convert.ToString(Request.QueryString["industryset"]));
                    FillGrdByIndustry(industryset, Navigation.First);
                }
            }
            if (Request.QueryString["mode"] != null && Request.QueryString["skillset"] != null)
            {
                if (clsEncryptionDecryption.DecryptQueryString(Convert.ToString(Request.QueryString["mode"])) == "BySkills")
                {
                    industryset = clsEncryptionDecryption.DecryptQueryString(Convert.ToString(Request.QueryString["skillset"]));
                    FillGrdBySkills(industryset, Navigation.First);
                }
            }
            if (Request.QueryString["mode"] != null && Request.QueryString["minexp"] != null && Request.QueryString["maxexp"] != null)
            {
                if (clsEncryptionDecryption.DecryptQueryString(Convert.ToString(Request.QueryString["mode"])) == "ByExperience")
                {
                    minexp = clsEncryptionDecryption.DecryptQueryString(Convert.ToString(Request.QueryString["minexp"]));
                    maxexp = clsEncryptionDecryption.DecryptQueryString(Convert.ToString(Request.QueryString["maxexp"]));
                    FillgrdByExperience(minexp, maxexp, Navigation.First);
                }
            }
            if (Request.QueryString["mode"] != null)
            {
                if (clsEncryptionDecryption.DecryptQueryString(Convert.ToString(Request.QueryString["mode"])) == "Advanced")
                {
                    string sk = "", ind = "", fun = "", exp = "", jobl = "";
                    if (Request.QueryString["skillset"] != null)
                        sk = clsEncryptionDecryption.DecryptQueryString(Convert.ToString(Request.QueryString["skillset"]));
                    if (Request.QueryString["industryset"] != null)
                        ind = clsEncryptionDecryption.DecryptQueryString(Convert.ToString(Request.QueryString["industryset"]));
                    if (Request.QueryString["functionalarea"] != null)
                        fun = clsEncryptionDecryption.DecryptQueryString(Convert.ToString(Request.QueryString["functionalarea"]));
                    if (Request.QueryString["experience"] != null)
                        exp = clsEncryptionDecryption.DecryptQueryString(Convert.ToString(Request.QueryString["experience"]));
                    if (Request.QueryString["joblocation"] != null)
                        jobl = clsEncryptionDecryption.DecryptQueryString(Convert.ToString(Request.QueryString["joblocation"]));
                    FillgrdByAdvance(sk, ind, exp, fun, jobl, Navigation.First);
                }
            }
        }
    }

    protected void FillgrdByAdvance(string SkillSet, string IndustrySet, string minexp, string functionalarea, string location, Navigation navigation)
    {
        try
        {
            clsSearchResume objclsSearchJob = new clsSearchResume();
            List<clsResumeSearchResultBo> objclsSearchResultList = new List<clsResumeSearchResultBo>();
            clsResumeSearchResultBo objclsSearchResult = new clsResumeSearchResultBo();
            objclsSearchResultList = objclsSearchJob.GetResumeAdvanceSearch(SkillSet, IndustrySet, Convert.ToInt32(minexp), Convert.ToInt32(functionalarea), Convert.ToInt32(location));
            if (objclsSearchResultList != null)
            {
                if (objclsSearchResultList.Count > 0)
                {
                    rptrSearchByIndustry.DataSource = objclsSearchResultList;
                    rptrSearchByIndustry.DataBind();
                    PagedDataSource objPds = new PagedDataSource();
                    objPds.DataSource = objclsSearchResultList;
                    objPds.AllowPaging = true;
                    objPds.PageSize = int.Parse(ddlPageSize.SelectedValue);
                    switch (navigation)
                    {
                        case Navigation.Next:       //Increment NowViewing by 1
                            NowViewing++;
                            break;
                        case Navigation.Previous:   //Decrement NowViewing by 1
                            NowViewing--;
                            break;
                        case Navigation.Last:       //Make NowViewing to last page for PagedDataSource
                            NowViewing = objPds.PageCount - 1;
                            break;
                        case Navigation.Pager:      //Change NowViewing based on pager size and page count
                            if (int.Parse(ddlPageSize.SelectedValue) >= objPds.PageCount)
                                NowViewing = objPds.PageCount - 1;
                            break;
                        case Navigation.Sorting:
                            break;
                        default:                    //Default NowViewing set to 0
                            NowViewing = 0;
                            break;
                    }

                    objPds.CurrentPageIndex = NowViewing;
                    lblCurrentPage.Text = "Now viewing : " + (NowViewing + 1).ToString() + " of " + objPds.PageCount.ToString();
                    // Disable Prev, Next, First, Last buttons if necessary
                    lbtnPrev.Enabled = !objPds.IsFirstPage;
                    lbtnNext.Enabled = !objPds.IsLastPage;
                    lbtnFirst.Enabled = !objPds.IsFirstPage;
                    lbtnLast.Enabled = !objPds.IsLastPage;
                    dvNoRecords.Visible = false;
                }
                else
                {
                    rptrSearchByIndustry.DataSource = null;
                    rptrSearchByIndustry.DataBind();
                    dvNoRecords.Visible = true;
                }
            }

        }
        catch (Exception)
        {
            throw;
        }
    }

    protected void FillgrdByExperience(string minexp, string maxexp, Navigation navigation)
    {
        try
        {
            clsSearchResume objclsSearchResume = new clsSearchResume();
            List<clsResumeSearchResultBo> objclsSearchResultList = new List<clsResumeSearchResultBo>();
            clsResumeSearchResultBo objclsSearchResult = new clsResumeSearchResultBo();
            objclsSearchResultList = objclsSearchResume.GetResumeByExperience(Convert.ToInt32(minexp), Convert.ToInt32(maxexp));
            if (objclsSearchResultList != null)
            {
                if (objclsSearchResultList.Count > 0)
                {
                    rptrSearchByIndustry.DataSource = objclsSearchResultList;
                    rptrSearchByIndustry.DataBind();
                    PagedDataSource objPds = new PagedDataSource();
                    objPds.DataSource = objclsSearchResultList;
                    objPds.AllowPaging = true;
                    objPds.PageSize = int.Parse(ddlPageSize.SelectedValue);
                    switch (navigation)
                    {
                        case Navigation.Next:       //Increment NowViewing by 1
                            NowViewing++;
                            break;
                        case Navigation.Previous:   //Decrement NowViewing by 1
                            NowViewing--;
                            break;
                        case Navigation.Last:       //Make NowViewing to last page for PagedDataSource
                            NowViewing = objPds.PageCount - 1;
                            break;
                        case Navigation.Pager:      //Change NowViewing based on pager size and page count
                            if (int.Parse(ddlPageSize.SelectedValue) >= objPds.PageCount)
                                NowViewing = objPds.PageCount - 1;
                            break;
                        case Navigation.Sorting:
                            break;
                        default:                    //Default NowViewing set to 0
                            NowViewing = 0;
                            break;
                    }

                    objPds.CurrentPageIndex = NowViewing;
                    lblCurrentPage.Text = "Now viewing : " + (NowViewing + 1).ToString() + " of " + objPds.PageCount.ToString();
                    // Disable Prev, Next, First, Last buttons if necessary
                    lbtnPrev.Enabled = !objPds.IsFirstPage;
                    lbtnNext.Enabled = !objPds.IsLastPage;
                    lbtnFirst.Enabled = !objPds.IsFirstPage;
                    lbtnLast.Enabled = !objPds.IsLastPage;
                    dvNoRecords.Visible = false;
                }
                else
                {
                    rptrSearchByIndustry.DataSource = null;
                    rptrSearchByIndustry.DataBind();
                    dvNoRecords.Visible = true;
                }
            }

        }
        catch (Exception)
        {
            throw;
        }
    }

    protected void FillGrdBySkills(string skills, Navigation navigation)
    {

        try
        {
            string[] SkillSet = skills.Trim().ToLower().Split(',');
            clsSearchResume objclsSearchResume = new clsSearchResume();
            List<clsResumeSearchResultBo> objclsSearchResultList = new List<clsResumeSearchResultBo>();
            clsResumeSearchResultBo objclsSearchResult = new clsResumeSearchResultBo();
            objclsSearchResultList = objclsSearchResume.GetResumeBySkills(SkillSet);
            if (objclsSearchResultList != null)
            {
                if (objclsSearchResultList.Count > 0)
                {
                    rptrSearchByIndustry.DataSource = objclsSearchResultList;
                    rptrSearchByIndustry.DataBind();
                    PagedDataSource objPds = new PagedDataSource();
                    objPds.DataSource = objclsSearchResultList;
                    objPds.AllowPaging = true;
                    objPds.PageSize = int.Parse(ddlPageSize.SelectedValue);
                    switch (navigation)
                    {
                        case Navigation.Next:       //Increment NowViewing by 1
                            NowViewing++;
                            break;
                        case Navigation.Previous:   //Decrement NowViewing by 1
                            NowViewing--;
                            break;
                        case Navigation.Last:       //Make NowViewing to last page for PagedDataSource
                            NowViewing = objPds.PageCount - 1;
                            break;
                        case Navigation.Pager:      //Change NowViewing based on pager size and page count
                            if (int.Parse(ddlPageSize.SelectedValue) >= objPds.PageCount)
                                NowViewing = objPds.PageCount - 1;
                            break;
                        case Navigation.Sorting:
                            break;
                        default:                    //Default NowViewing set to 0
                            NowViewing = 0;
                            break;
                    }

                    objPds.CurrentPageIndex = NowViewing;
                    lblCurrentPage.Text = "Now viewing : " + (NowViewing + 1).ToString() + " of " + objPds.PageCount.ToString();
                    // Disable Prev, Next, First, Last buttons if necessary
                    lbtnPrev.Enabled = !objPds.IsFirstPage;
                    lbtnNext.Enabled = !objPds.IsLastPage;
                    lbtnFirst.Enabled = !objPds.IsFirstPage;
                    lbtnLast.Enabled = !objPds.IsLastPage;
                    dvNoRecords.Visible = false;

                }
                else
                {
                    rptrSearchByIndustry.DataSource = null;
                    rptrSearchByIndustry.DataBind();
                    dvNoRecords.Visible = true;
                }
            }
        }
        catch (Exception)
        {
            throw;
        }
    }

    protected void FillGrdByIndustry(string industry, Navigation navigation)
    {
        string[] Industries = industry.Trim().ToLower().Split(',');
        clsSearchResume objclsSearchResume = new clsSearchResume();
        List<clsResumeSearchResultBo> objclsSearchResultList = new List<clsResumeSearchResultBo>();
        clsResumeSearchResultBo objclsSearchResult = new clsResumeSearchResultBo();
        objclsSearchResultList = objclsSearchResume.GetResumeByIndustry(Industries);
        if (objclsSearchResultList != null)
        {
            if (objclsSearchResultList.Count > 0)
            {
                rptrSearchByIndustry.DataSource = objclsSearchResultList;
                rptrSearchByIndustry.DataBind();
                PagedDataSource objPds = new PagedDataSource();
                objPds.DataSource = objclsSearchResultList;
                objPds.AllowPaging = true;
                objPds.PageSize = int.Parse(ddlPageSize.SelectedValue);
                switch (navigation)
                {
                    case Navigation.Next:       //Increment NowViewing by 1
                        NowViewing++;
                        break;
                    case Navigation.Previous:   //Decrement NowViewing by 1
                        NowViewing--;
                        break;
                    case Navigation.Last:       //Make NowViewing to last page for PagedDataSource
                        NowViewing = objPds.PageCount - 1;
                        break;
                    case Navigation.Pager:      //Change NowViewing based on pager size and page count
                        if (int.Parse(ddlPageSize.SelectedValue) >= objPds.PageCount)
                            NowViewing = objPds.PageCount - 1;
                        break;
                    case Navigation.Sorting:
                        break;
                    default:                    //Default NowViewing set to 0
                        NowViewing = 0;
                        break;
                }

                objPds.CurrentPageIndex = NowViewing;
                lblCurrentPage.Text = "Now viewing : " + (NowViewing + 1).ToString() + " of " + objPds.PageCount.ToString();
                // Disable Prev, Next, First, Last buttons if necessary
                lbtnPrev.Enabled = !objPds.IsFirstPage;
                lbtnNext.Enabled = !objPds.IsLastPage;
                lbtnFirst.Enabled = !objPds.IsFirstPage;
                lbtnLast.Enabled = !objPds.IsLastPage;
                dvNoRecords.Visible = false;

            }
            else
            {
                rptrSearchByIndustry.DataSource = null;
                rptrSearchByIndustry.DataBind();
                dvNoRecords.Visible = true;

            }
        }
    }

    protected void rptrSearchByIndustry_ItemCommand(object source, RepeaterCommandEventArgs e)
    {
        if (e.CommandName == "ViewCV")
        {
            if (Session["UserId"] != null)
            {
                string UserId = Convert.ToString(e.CommandArgument);
                clsSearchResume objclsSearchResume = new clsSearchResume();
                clsResumeSearchResultBo objclsResumeSearchResultBo = new clsResumeSearchResultBo();
                objclsResumeSearchResultBo = objclsSearchResume.GetResumeByUserId(Convert.ToInt32(UserId));

                if (objclsResumeSearchResultBo != null)
                {
                    redirectlink = "ResumeDetails.aspx?userid=" + Convert.ToString(e.CommandArgument);
                    string skillset = Convert.ToString(objclsResumeSearchResultBo.SKILL_SET);
                    if (skillset != "" && skillset != null)
                    {
                        skillset = clsEncryptionDecryption.EncryptQueryString(skillset);
                        redirectlink += "&skillset=" + industryset;
                    }
                    string email = Convert.ToString(objclsResumeSearchResultBo.EMAIL);
                    if (email != "" && email != null)
                    {
                        email = clsEncryptionDecryption.EncryptQueryString(email);
                        redirectlink += "&email=" + email;
                    }
                    string mobile = Convert.ToString(objclsResumeSearchResultBo.MOBILE);
                    if (mobile != "" && mobile != null)
                    {
                        mobile = clsEncryptionDecryption.EncryptQueryString(mobile);
                        redirectlink += "&mobile=" + mobile;
                    }
                    string phone = Convert.ToString(objclsResumeSearchResultBo.PHONE);
                    if (phone != "" && phone != null)
                    {
                        phone = clsEncryptionDecryption.EncryptQueryString(phone);
                        redirectlink += "&phone=" + phone;
                    }
                    string experience = Convert.ToString(objclsResumeSearchResultBo.EXPERIENCE);
                    if (experience != "" && experience != null)
                    {
                        experience = clsEncryptionDecryption.EncryptQueryString(experience);
                        redirectlink += "&experience=" + experience;
                    }
                    string currentcomp = Convert.ToString(objclsResumeSearchResultBo.CURRENT_COMPANY);
                    if (currentcomp != "" && currentcomp != null)
                    {
                        currentcomp = clsEncryptionDecryption.EncryptQueryString(currentcomp);
                        redirectlink += "&currentcomp=" + currentcomp;
                    }
                    string currentdesig = Convert.ToString(objclsResumeSearchResultBo.CURRENT_POST);
                    if (currentdesig != "" && currentdesig != null)
                    {
                        currentdesig = clsEncryptionDecryption.EncryptQueryString(currentdesig);
                        redirectlink += "&currentdesig=" + currentdesig;
                    }
                    string currentloc = Convert.ToString(objclsResumeSearchResultBo.CURRENT_LOCATION);
                    if (currentloc != "" && currentloc != null)
                    {
                        currentloc = clsEncryptionDecryption.EncryptQueryString(currentloc);
                        redirectlink += "&currentloc=" + currentloc;
                    }
                    string currentctc = Convert.ToString(objclsResumeSearchResultBo.CURRENT_CTC);
                    if (currentctc != "" && currentctc != null)
                    {
                        currentctc = clsEncryptionDecryption.EncryptQueryString(currentctc);
                        redirectlink += "&currentctc=" + currentctc;
                    }
                    string functionalarea = Convert.ToString(objclsResumeSearchResultBo.FUNCTIONAL_AREA);
                    if (functionalarea != "" && functionalarea != null)
                    {
                        functionalarea = clsEncryptionDecryption.EncryptQueryString(functionalarea);
                        redirectlink += "&functionalarea=" + functionalarea;
                    }
                    string preferredlocation = Convert.ToString(objclsResumeSearchResultBo.PREFERRED_LOCATION);
                    if (preferredlocation != "" && preferredlocation != null)
                    {
                        preferredlocation = clsEncryptionDecryption.EncryptQueryString(preferredlocation);
                        redirectlink += "&preferredlocation=" + preferredlocation;
                    }
                    string cvpath = Convert.ToString(objclsResumeSearchResultBo.CV_PATH);
                    if (cvpath != "" && cvpath != null)
                    {
                        cvpath = clsEncryptionDecryption.EncryptQueryString(cvpath);
                        redirectlink += "&cvpath=" + cvpath;
                    }
                    string downloadtill = Convert.ToString(objclsResumeSearchResultBo.DOWNLOAD_TILL);
                    if (downloadtill != "" && downloadtill != null)
                    {
                        downloadtill = clsEncryptionDecryption.EncryptQueryString(downloadtill);
                        redirectlink += "&downloadtill=" + downloadtill;
                    }
                    Response.Redirect(redirectlink);
                }
            }
            else
            {
                Response.Redirect("EmployerLogin.aspx");
            }
        }
    }
    protected void rptrSearchByIndustry_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        try
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                clsResumeSearchResultBo clid = new clsResumeSearchResultBo();
                clid = (clsResumeSearchResultBo)e.Item.DataItem;
                int cc = clid.CURRENT_LOCATION;
                clsCity objclsCity = new clsCity();
                IN_TB_CITY objIN_TB_CITY = new IN_TB_CITY();
                objIN_TB_CITY = objclsCity.GetCityById(cc);
                if (objIN_TB_CITY != null)
                {
                    var lblCurrentLoc = (Label)e.Item.FindControl("lblCurrentLoc");
                    lblCurrentLoc.Text = Convert.ToString(objIN_TB_CITY.CITY);
                }
            }

        }
        catch (Exception)
        {

            throw;
        }
    }

    public int NowViewing
    {
        get
        {
            object obj = ViewState["_NowViewing"];
            if (obj == null)
                return 0;
            else
                return (int)obj;
        }
        set
        {
            this.ViewState["_NowViewing"] = value;
        }
    }

    protected override void OnInitComplete(EventArgs e)
    {
        base.OnInitComplete(e);
        ddlPageSize.SelectedIndexChanged += new EventHandler(ddlPageSize_SelectedIndexChanged);
    }

    void ddlPageSize_SelectedIndexChanged(object sender, EventArgs e)
    {
        if (Request.QueryString["mode"] != null && Request.QueryString["industryset"] != null)
        {
            if (clsEncryptionDecryption.DecryptQueryString(Convert.ToString(Request.QueryString["mode"])) == "ByIndustry")
            {
                industryset = clsEncryptionDecryption.DecryptQueryString(Convert.ToString(Request.QueryString["mode"]));
                FillGrdByIndustry(industryset, Navigation.Pager);
            }
        }
        if (Request.QueryString["mode"] != null && Request.QueryString["skillset"] != null)
        {
            if (clsEncryptionDecryption.DecryptQueryString(Convert.ToString(Request.QueryString["mode"])) == "BySkills")
            {
                industryset = clsEncryptionDecryption.DecryptQueryString(Convert.ToString(Request.QueryString["skillset"]));
                FillGrdBySkills(industryset, Navigation.Pager);
            }
        }
        if (Request.QueryString["mode"] != null && Request.QueryString["minexp"] != null && Request.QueryString["maxexp"] != null)
        {
            if (clsEncryptionDecryption.DecryptQueryString(Convert.ToString(Request.QueryString["mode"])) == "ByExperience")
            {
                minex = clsEncryptionDecryption.DecryptQueryString(Convert.ToString(Request.QueryString["minexp"]));
                maxex = clsEncryptionDecryption.DecryptQueryString(Convert.ToString(Request.QueryString["maxexp"]));
                FillgrdByExperience(minexp, maxexp, Navigation.Pager);
            }
        }
        if (Request.QueryString["mode"] != null)
        {
            if (clsEncryptionDecryption.DecryptQueryString(Convert.ToString(Request.QueryString["mode"])) == "Advanced")
            {
                string sk = "", ind = "", fun = "", exp = "", jobl = "";
                if (Request.QueryString["skillset"] != null)
                    sk = clsEncryptionDecryption.DecryptQueryString(Convert.ToString(Request.QueryString["skillset"]));
                if (Request.QueryString["industryset"] != null)
                    ind = clsEncryptionDecryption.DecryptQueryString(Convert.ToString(Request.QueryString["industryset"]));
                if (Request.QueryString["functionalarea"] != null)
                    fun = clsEncryptionDecryption.DecryptQueryString(Convert.ToString(Request.QueryString["functionalarea"]));
                if (Request.QueryString["experience"] != null)
                    exp = clsEncryptionDecryption.DecryptQueryString(Convert.ToString(Request.QueryString["experience"]));
                if (Request.QueryString["joblocation"] != null)
                    jobl = clsEncryptionDecryption.DecryptQueryString(Convert.ToString(Request.QueryString["joblocation"]));
                FillgrdByAdvance(sk, ind, exp, fun, jobl, Navigation.Pager);
            }
        }

    }


    protected void lbtnPrev_Click(object sender, EventArgs e)
    {
        if (Request.QueryString["mode"] != null && Request.QueryString["industryset"] != null)
        {
            if (clsEncryptionDecryption.DecryptQueryString(Convert.ToString(Request.QueryString["mode"])) == "ByIndustry")
            {
                industryset = clsEncryptionDecryption.DecryptQueryString(Convert.ToString(Request.QueryString["mode"]));
                FillGrdByIndustry(industryset, Navigation.Previous);
            }
        }
        if (Request.QueryString["mode"] != null && Request.QueryString["skillset"] != null)
        {
            if (clsEncryptionDecryption.DecryptQueryString(Convert.ToString(Request.QueryString["mode"])) == "BySkills")
            {
                industryset = clsEncryptionDecryption.DecryptQueryString(Convert.ToString(Request.QueryString["skillset"]));
                FillGrdBySkills(industryset, Navigation.Previous);
            }
        }
        if (Request.QueryString["mode"] != null && Request.QueryString["minexp"] != null && Request.QueryString["maxexp"] != null)
        {
            if (clsEncryptionDecryption.DecryptQueryString(Convert.ToString(Request.QueryString["mode"])) == "ByExperience")
            {
                minex = clsEncryptionDecryption.DecryptQueryString(Convert.ToString(Request.QueryString["minexp"]));
                maxex = clsEncryptionDecryption.DecryptQueryString(Convert.ToString(Request.QueryString["maxexp"]));
                FillgrdByExperience(minexp, maxexp, Navigation.Previous);
            }
        }
        if (Request.QueryString["mode"] != null)
        {
            if (clsEncryptionDecryption.DecryptQueryString(Convert.ToString(Request.QueryString["mode"])) == "Advanced")
            {
                string sk = "", ind = "", fun = "", exp = "", jobl = "";
                if (Request.QueryString["skillset"] != null)
                    sk = clsEncryptionDecryption.DecryptQueryString(Convert.ToString(Request.QueryString["skillset"]));
                if (Request.QueryString["industryset"] != null)
                    ind = clsEncryptionDecryption.DecryptQueryString(Convert.ToString(Request.QueryString["industryset"]));
                if (Request.QueryString["functionalarea"] != null)
                    fun = clsEncryptionDecryption.DecryptQueryString(Convert.ToString(Request.QueryString["functionalarea"]));
                if (Request.QueryString["experience"] != null)
                    exp = clsEncryptionDecryption.DecryptQueryString(Convert.ToString(Request.QueryString["experience"]));
                if (Request.QueryString["joblocation"] != null)
                    jobl = clsEncryptionDecryption.DecryptQueryString(Convert.ToString(Request.QueryString["joblocation"]));
                FillgrdByAdvance(sk, ind, exp, fun, jobl, Navigation.Previous);
            }
        }
    }

    protected void lbtnNext_Click(object sender, EventArgs e)
    {
        if (Request.QueryString["mode"] != null && Request.QueryString["industryset"] != null)
        {
            if (clsEncryptionDecryption.DecryptQueryString(Convert.ToString(Request.QueryString["mode"])) == "ByIndustry")
            {
                industryset = clsEncryptionDecryption.DecryptQueryString(Convert.ToString(Request.QueryString["industryset"]));
                FillGrdByIndustry(industryset, Navigation.Next);
            }
        }
        if (Request.QueryString["mode"] != null && Request.QueryString["skillset"] != null)
        {
            if (clsEncryptionDecryption.DecryptQueryString(Convert.ToString(Request.QueryString["mode"])) == "BySkills")
            {
                industryset = clsEncryptionDecryption.DecryptQueryString(Convert.ToString(Request.QueryString["skillset"]));
                FillGrdBySkills(industryset, Navigation.Next);
            }
        }
        if (Request.QueryString["mode"] != null && Request.QueryString["minexp"] != null && Request.QueryString["maxexp"] != null)
        {
            if (clsEncryptionDecryption.DecryptQueryString(Convert.ToString(Request.QueryString["mode"])) == "ByExperience")
            {
                minex = clsEncryptionDecryption.DecryptQueryString(Convert.ToString(Request.QueryString["minexp"]));
                maxex = clsEncryptionDecryption.DecryptQueryString(Convert.ToString(Request.QueryString["maxexp"]));
                FillgrdByExperience(minexp, maxexp, Navigation.Next);
            }
        }
        if (Request.QueryString["mode"] != null)
        {
            if (clsEncryptionDecryption.DecryptQueryString(Convert.ToString(Request.QueryString["mode"])) == "Advanced")
            {
                string sk = "", ind = "", fun = "", exp = "", jobl = "";
                if (Request.QueryString["skillset"] != null)
                    sk = clsEncryptionDecryption.DecryptQueryString(Convert.ToString(Request.QueryString["skillset"]));
                if (Request.QueryString["industryset"] != null)
                    ind = clsEncryptionDecryption.DecryptQueryString(Convert.ToString(Request.QueryString["industryset"]));
                if (Request.QueryString["functionalarea"] != null)
                    fun = clsEncryptionDecryption.DecryptQueryString(Convert.ToString(Request.QueryString["functionalarea"]));
                if (Request.QueryString["experience"] != null)
                    exp = clsEncryptionDecryption.DecryptQueryString(Convert.ToString(Request.QueryString["experience"]));
                if (Request.QueryString["joblocation"] != null)
                    jobl = clsEncryptionDecryption.DecryptQueryString(Convert.ToString(Request.QueryString["joblocation"]));
                FillgrdByAdvance(sk, ind, exp, fun, jobl, Navigation.Next);
            }
        }
    }

    protected void lbtnFirst_Click(object sender, EventArgs e)
    {
        if (Request.QueryString["mode"] != null && Request.QueryString["industryset"] != null)
        {
            if (clsEncryptionDecryption.DecryptQueryString(Convert.ToString(Request.QueryString["mode"])) == "ByIndustry")
            {
                industryset = clsEncryptionDecryption.DecryptQueryString(Convert.ToString(Request.QueryString["mode"]));
                FillGrdByIndustry(industryset, Navigation.First);
            }
        }
        if (Request.QueryString["mode"] != null && Request.QueryString["skillset"] != null)
        {
            if (clsEncryptionDecryption.DecryptQueryString(Convert.ToString(Request.QueryString["mode"])) == "BySkills")
            {
                industryset = clsEncryptionDecryption.DecryptQueryString(Convert.ToString(Request.QueryString["skillset"]));
                FillGrdBySkills(industryset, Navigation.First);
            }
        }
        if (Request.QueryString["mode"] != null && Request.QueryString["minexp"] != null && Request.QueryString["maxexp"] != null)
        {
            if (clsEncryptionDecryption.DecryptQueryString(Convert.ToString(Request.QueryString["mode"])) == "ByExperience")
            {
                minex = clsEncryptionDecryption.DecryptQueryString(Convert.ToString(Request.QueryString["minexp"]));
                maxex = clsEncryptionDecryption.DecryptQueryString(Convert.ToString(Request.QueryString["maxexp"]));
                FillgrdByExperience(minexp, maxexp, Navigation.First);
            }
        }
        if (Request.QueryString["mode"] != null)
        {
            if (clsEncryptionDecryption.DecryptQueryString(Convert.ToString(Request.QueryString["mode"])) == "Advanced")
            {
                string sk = "", ind = "", fun = "", exp = "", jobl = "";
                if (Request.QueryString["skillset"] != null)
                    sk = clsEncryptionDecryption.DecryptQueryString(Convert.ToString(Request.QueryString["skillset"]));
                if (Request.QueryString["industryset"] != null)
                    ind = clsEncryptionDecryption.DecryptQueryString(Convert.ToString(Request.QueryString["industryset"]));
                if (Request.QueryString["functionalarea"] != null)
                    fun = clsEncryptionDecryption.DecryptQueryString(Convert.ToString(Request.QueryString["functionalarea"]));
                if (Request.QueryString["experience"] != null)
                    exp = clsEncryptionDecryption.DecryptQueryString(Convert.ToString(Request.QueryString["experience"]));
                if (Request.QueryString["joblocation"] != null)
                    jobl = clsEncryptionDecryption.DecryptQueryString(Convert.ToString(Request.QueryString["joblocation"]));
                FillgrdByAdvance(sk, ind, exp, fun, jobl, Navigation.First);
            }
        }
    }

    protected void lbtnLast_Click(object sender, ImageClickEventArgs e)
    {
        if (Request.QueryString["mode"] != null && Request.QueryString["industryset"] != null)
        {
            if (clsEncryptionDecryption.DecryptQueryString(Convert.ToString(Request.QueryString["mode"])) == "ByIndustry")
            {
                industryset = clsEncryptionDecryption.DecryptQueryString(Convert.ToString(Request.QueryString["industryset"]));
                FillGrdByIndustry(industryset, Navigation.Last);
            }
        }
        if (Request.QueryString["mode"] != null && Request.QueryString["skillset"] != null)
        {
            if (clsEncryptionDecryption.DecryptQueryString(Convert.ToString(Request.QueryString["mode"])) == "BySkills")
            {
                industryset = clsEncryptionDecryption.DecryptQueryString(Convert.ToString(Request.QueryString["skillset"]));
                FillGrdBySkills(industryset, Navigation.Last);
            }
        }
        if (Request.QueryString["mode"] != null && Request.QueryString["minexp"] != null && Request.QueryString["maxexp"] != null)
        {
            if (clsEncryptionDecryption.DecryptQueryString(Convert.ToString(Request.QueryString["mode"])) == "ByExperience")
            {
                minex = clsEncryptionDecryption.DecryptQueryString(Convert.ToString(Request.QueryString["minexp"]));
                maxex = clsEncryptionDecryption.DecryptQueryString(Convert.ToString(Request.QueryString["maxexp"]));
                FillgrdByExperience(minexp, maxexp, Navigation.Last);
            }
        }
        if (Request.QueryString["mode"] != null)
        {
            if (clsEncryptionDecryption.DecryptQueryString(Convert.ToString(Request.QueryString["mode"])) == "Advanced")
            {
                string sk = "", ind = "", fun = "", exp = "", jobl = "";
                if (Request.QueryString["skillset"] != null)
                    sk = clsEncryptionDecryption.DecryptQueryString(Convert.ToString(Request.QueryString["skillset"]));
                if (Request.QueryString["industryset"] != null)
                    ind = clsEncryptionDecryption.DecryptQueryString(Convert.ToString(Request.QueryString["industryset"]));
                if (Request.QueryString["functionalarea"] != null)
                    fun = clsEncryptionDecryption.DecryptQueryString(Convert.ToString(Request.QueryString["functionalarea"]));
                if (Request.QueryString["experience"] != null)
                    exp = clsEncryptionDecryption.DecryptQueryString(Convert.ToString(Request.QueryString["experience"]));
                if (Request.QueryString["joblocation"] != null)
                    jobl = clsEncryptionDecryption.DecryptQueryString(Convert.ToString(Request.QueryString["joblocation"]));
                FillgrdByAdvance(sk, ind, exp, fun, jobl, Navigation.Last);
            }
        }
    }
}
